//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2012 Microsoft Corporation. All Rights Reserved
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.   
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

namespace Preflight.Core
{
    using System;

    using Preflight.Model;
    using Preflight.Verifications;

    internal class StaticResultVerification : IVerification
    {
        private const string StandardName = "Preflight Engine Run";
        private readonly VerificationResult verificationResult;

        public StaticResultVerification(Exception exception, string message) : this(exception, message, StandardName, StandardCategoryNames.CriticalResource)
        {
        }

        public StaticResultVerification(Exception exception, string message, string verificationName, string verificationCategory)
        {
            this.Name = verificationName;
            this.Category = verificationCategory;
            this.verificationResult = new VerificationResult(this);
            this.verificationResult.AddMessage(MessageType.Error, message);
            this.verificationResult.AddException(exception);
        }

        public string Name
        {
            get;
            private set;
        }

        public string Category
        {
            get;
            private set;
        }

        public VerificationResult Run()
        {
            return this.verificationResult;
        }

        public bool IsSameAs(IVerification verification)
        {
            return false;
        }
    }
}
